package com.weme.live.activity

import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.alibaba.android.arouter.facade.annotation.Route
import com.gyf.immersionbar.BarHide
import com.gyf.immersionbar.ImmersionBar
import com.weme.common.arouter.ARouterPaths
import com.weme.common.base.BaseMvvmActivity
import com.weme.live.databinding.ActivityHistoryBinding
import com.weme.live.fragment.AllHistoryFragment
import com.weme.live.viewmode.HistorViewMode


@Route(path = ARouterPaths.HISTORY_ACTIVITY)
class HistoryActivity :BaseMvvmActivity<ActivityHistoryBinding,HistorViewMode>() {
    override fun getViewModelClass(): Class<HistorViewMode> = HistorViewMode::class.java

    override fun initView(savedInstanceState: Bundle?) {
        ImmersionBar.with(this).hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR).titleBar(mBinding.customTopNavigationBar).init()
        val fragments = listOf(AllHistoryFragment(0),AllHistoryFragment(1),AllHistoryFragment(2))
        val labels = listOf(getString(com.example.resources.R.string.history_all), getString(com.example.resources.R.string.history_missed),getString(com.example.resources.R.string.history_matches))

        mBinding.viewPager.adapter = object : FragmentStateAdapter(this) {
            override fun getItemCount(): Int {
                return fragments.size
            }

            override fun createFragment(p0: Int): Fragment {
                return fragments[p0]
            }
        }

        mBinding.indicator.attachViewPager(mBinding.viewPager, labels)
    }

    
}